<?php
class softlab
{
	static $status=array('毕业生', '在读研究生', '在读博士生', '教师');
	static $sex=array('m'=>'男', 'f'=>'女');

	public static function pretreat($data)
	{
		if (!is_array($data))
			return null;

		foreach ($data as $k => $v) {
			switch ($k) {
			case 'Status':
				$d['Status']=self::$status[$v];
				break;
			case 'Sex':
				$d['Sex']=self::$sex[$v];
				break;
			case 'Birth':
			case 'EnrollDate':
				$d[$k]=strftime('%Y', $v);
				break;
			case 'Icon':
				if (empty($v))
					$d['Icon']='default.gif';
				else
					$d['Icon']=$v;
				break;
			default:
				if (is_numeric($v))
					$d[$k]=$v;
				else
					$d[$k]=preg_replace('/(<script)(.*)(<\/script>)/i',
							'&lt;script\2&lt;/script&gt;', $v);
			} // end of switch
		} // end of foreach

		return $d;
	}
};
?>
